local skel = fk.CreateSkill({
    name = "sj5__yiron",
  })
  
  Fk:loadTranslationTable{
    ["sj5__yiron"] = "移荣",
    [":sj5__yiron"] = "出牌阶段每项限一次，你可以：X.将手牌数调整至X，或将X调整至手牌数，然后X-1。（X为你的手牌上限）",

    ["@sj5__yiron-phase"] = "移荣",
    ["#sj5__yiron"] = "移荣：你可以将手牌数调整至%arg，或将手牌上限调整至%arg2，然后你的手牌上限-1",
    ["#sj5__yiron_1"] = "将手牌数调整至%arg",
    ["#sj5__yiron_2"] = "将手牌上限调整至%arg",

   ["$sj5__yiron1"] = "花开彼岸，繁荣不减当年。",
   ["$sj5__yiron2"] = "移花接木，花容更胜从前。",
  }

  skel:addEffect("active", {
  prompt = function (self, player, selected_cards, selected_targets)
    return "#sj5__yiron:::"..player:getMaxCards() ..":".. player:getHandcardNum()
  end,
  interaction = function (self, player)
    local ask = {}
    for i = 1, 2, 1 do
      local n = (i == 1 and player:getMaxCards() or player:getHandcardNum())
      local s = "#sj5__yiron_"..i..":::"..n
      table.insert(ask,s)
    end
    return UI.ComboBox{choices = ask}
  end,
   can_use = function(self, player)
    local max = player:getMaxCards()
    return player:getHandcardNum() ~= max and not table.contains(player:getTableMark("sj5__yiron-phase"),max)
   end,
   card_filter = function (self, player, to_select, selected)
    local n = player:getHandcardNum() - player:getMaxCards()
    if self.interaction.data == "#sj5__yiron_1:::"..player:getMaxCards() and n > 0 then
      return #selected < n and table.contains(player:getCardIds("h"),to_select) and not player:prohibitDiscard(to_select)
    end
    return false
   end,
   target_filter = Util.FalseFunc,
   feasible = function (self, player, selected, selected_cards, card)
    local n = player:getHandcardNum() - player:getMaxCards()
    if self.interaction.data == "#sj5__yiron_1:::"..player:getMaxCards() and n > 0 then
      return #selected_cards == n
    end
    return true
   end,
   on_use = function(self, room, effect)
    local player = effect.from
    local max = player:getMaxCards()
    room:addTableMark(player,"sj5__yiron-phase",max)
    room:setPlayerMark(player,"@sj5__yiron-phase",table.concat(player:getTableMark("sj5__yiron-phase"),"/"))
    if self.interaction.data == "#sj5__yiron_1:::"..max then
      local n = player:getHandcardNum() - max
      if n > 0 then
        room:throwCard(effect.cards,skel.name,player,player)
      else
        player:drawCards(-n,skel.name)
      end
    else
      local n = max - player:getHandcardNum()
      room:addPlayerMark(player,n > 0 and MarkEnum.MinusMaxCards or MarkEnum.AddMaxCards,math.abs(n))
    end
    room:addPlayerMark(player,MarkEnum.MinusMaxCards)
   end,
  })


  return skel